//package com.iplant.wms.controller.bpm;
//
//import com.iplant.base.controller.BaseController;
//import com.iplant.base.po.Pagination;
//import com.iplant.base.po.ServiceResult;
//import com.iplant.base.utils.RetCode;
//import com.iplant.base.utils.serializer.CloneTool;
//import com.iplant.base.utils.general.StringUtils;
//import com.iplant.basic.service.BPMService;
//import com.iplant.basic.service.po.bms.BMSEmployee;
//import com.iplant.basic.service.po.bpm.BPMJobFunction;
//import com.iplant.basic.service.po.bpm.BPMWarehouseWorker;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//import java.util.Map;
//
///**
// * 仓库职能作业人员控制器
// *
// * @author PengYouWang
// * 2022-10-21 16:08:09
// */
//@RestController
//@RequestMapping("/api/BPMWarehouseWorker")
//public class BPMWarehouseWorkerController extends BaseController {
//    private static final Logger logger = LoggerFactory.getLogger(BPMWarehouseWorkerController.class);
//
//    final
//    BPMService wBPMService;
//
//    public BPMWarehouseWorkerController(BPMService wBPMService) {
//        this.wBPMService = wBPMService;
//    }
//
//    /**
//     * 查单条
//     */
//    @GetMapping("/Info")
//    public Object Info(HttpServletRequest request) {
//        Object wResult;
//        try {
//            BMSEmployee wLoginUser = GetSession(request);
//
//            int wID = StringUtils.parseInt(request.getParameter("ID"));
//
//            ServiceResult<BPMWarehouseWorker> wServiceResult = wBPMService.BPM_QueryWarehouseWorker(wLoginUser, wID);
//
//            if (StringUtils.isEmpty(wServiceResult.getFaultCode())) {
//                wResult = GetResult(RetCode.SERVER_CODE_SUC, "", null, wServiceResult.Result);
//            } else {
//                wResult = GetResult(RetCode.SERVER_CODE_ERR, wServiceResult.FaultCode);
//            }
//        } catch (Exception ex) {
//            logger.error(ex.toString());
//            wResult = GetResult(RetCode.SERVER_CODE_ERR, ex.toString());
//        }
//        return wResult;
//    }
//
//    /**
//     * 条件查询
//     */
//    @GetMapping("/All")
//    public Object All(HttpServletRequest request) {
//        Object wResult;
//        try {
//            BMSEmployee wLoginUser = GetSession(request);
//
//            int wID = StringUtils.parseInt(request.getParameter("ID"));
//            int wStoreID = StringUtils.parseInt(request.getParameter("StoreID"));
//            int wWorkerID = StringUtils.parseInt(request.getParameter("WorkerID"));
//            int wActive = StringUtils.parseInt(request.getParameter("Active"));
//
//            Pagination wPagination = GetPagination(request);
//
//            ServiceResult<List<BPMWarehouseWorker>> wServiceResult =
//                    wBPMService.BPM_QueryWarehouseWorkerList(wLoginUser,
//                            wID, wStoreID, wWorkerID, wPagination, wActive);
//
//            if (StringUtils.isEmpty(wServiceResult.getFaultCode())) {
//                wResult = GetResult(RetCode.SERVER_CODE_SUC, "", wServiceResult.Result, null);
//            } else {
//                wResult = GetResult(RetCode.SERVER_CODE_ERR, wServiceResult.FaultCode);
//            }
//        } catch (Exception ex) {
//            logger.error(ex.toString());
//            wResult = GetResult(RetCode.SERVER_CODE_ERR, ex.toString());
//        }
//        return wResult;
//    }
//
//    /**
//     * 新增或更新
//     */
//    @PostMapping("/Update")
//    public Object Update(HttpServletRequest request, @RequestBody Map<String, Object> wParam) {
//        Object wResult;
//        try {
//            BMSEmployee wLoginUser = GetSession(request);
//
//            if (!wParam.containsKey("data"))
//                return GetResult(RetCode.SERVER_CODE_ERR, RetCode.SERVER_RST_ERROR_OUT);
//
//            BPMWarehouseWorker wBPMWarehouseWorker = CloneTool.Clone(wParam.get("data"), BPMWarehouseWorker.class);
//            if (wBPMWarehouseWorker == null)
//                return GetResult(RetCode.SERVER_CODE_ERR, RetCode.SERVER_RST_ERROR_OUT);
//
//            ServiceResult<Integer> wServiceResult = wBPMService.BPM_UpdateWarehouseWorker(wLoginUser,
//                    wBPMWarehouseWorker);
//
//            if (StringUtils.isEmpty(wServiceResult.getFaultCode())) {
//                wResult = GetResult(RetCode.SERVER_CODE_SUC, "", null, wServiceResult.Result);
//            } else {
//                wResult = GetResult(RetCode.SERVER_CODE_ERR, wServiceResult.getFaultCode());
//            }
//        } catch (Exception ex) {
//            logger.error(ex.toString());
//            wResult = GetResult(RetCode.SERVER_CODE_ERR, ex.toString());
//        }
//        return wResult;
//    }
//
//    /**
//     * 批量激活禁用
//     */
//    @PostMapping("/ActiveList")
//    public Object ActiveList(HttpServletRequest request, @RequestBody Map<String, Object> wParam) {
//        Map<String, Object> wResult;
//        try {
//            BMSEmployee wLoginUser = GetSession(request);
//
//            List<BPMWarehouseWorker> wBPMWarehouseWorkerList = CloneTool.CloneArray(wParam.get("data"),
//                    BPMWarehouseWorker.class);
//            int wActive = StringUtils.parseInt(wParam.get("Active"));
//            if (wBPMWarehouseWorkerList == null || wBPMWarehouseWorkerList.size() == 0) {
//                return GetResult(RetCode.SERVER_CODE_ERR, RetCode.SERVER_RST_ERROR_OUT);
//            }
//
//            ServiceResult<Integer> wServiceResult = wBPMService.BPM_ActiveWarehouseWorkerList(wLoginUser,
//                    wBPMWarehouseWorkerList,
//                    wActive);
//
//            if (StringUtils.isEmpty(wServiceResult.FaultCode)) {
//                wResult = GetResult(RetCode.SERVER_CODE_SUC, "", null, wServiceResult.Result);
//            } else {
//                wResult = GetResult(RetCode.SERVER_CODE_ERR, wServiceResult.FaultCode);
//            }
//        } catch (Exception ex) {
//            logger.error(ex.toString());
//            wResult = GetResult(RetCode.SERVER_CODE_ERR, ex.toString());
//        }
//        return wResult;
//    }
//
//    /**
//     * 查询职能列表
//     */
//    @GetMapping("/JobFunctionAll")
//    public Object JobFunctionAll(HttpServletRequest request) {
//        Object wResult;
//        try {
//            BMSEmployee wLoginUser = GetSession(request);
//
//            ServiceResult<List<BPMJobFunction>> wServiceResult =
//                    wBPMService.BPM_QueryJobFunctionAll(wLoginUser);
//
//            if (StringUtils.isEmpty(wServiceResult.FaultCode)) {
//                wResult = GetResult(RetCode.SERVER_CODE_SUC, "", wServiceResult.Result, null);
//            } else {
//                wResult = GetResult(RetCode.SERVER_CODE_ERR, wServiceResult.FaultCode);
//            }
//        } catch (Exception ex) {
//            logger.error(ex.toString());
//            wResult = GetResult(RetCode.SERVER_CODE_ERR, ex.toString());
//        }
//        return wResult;
//    }
//}
